package com.fengqianrun.bootframework.config;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;

@Configuration
public class GlobalBeanConfig {

    /**
     * 系统国际化文件配置
     * @return MessageSource
     */
    @Bean(name = "messageSource")
    public MessageSource messageSource() {
        ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
        // msg 是文件前缀
        messageSource.setBasename("classpath:i18n/msg");
        messageSource.setDefaultEncoding("UTF-8");
        return messageSource;
    }

}
